package com.zhaotianhao.userservice.common;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * @Author Z-7
 * @Date 2022/3/22
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class JsonResult<T> {
    private Boolean result;
    private Integer code;
    private String msg;
    private T data;

    public static JsonResult successd(){
        return new JsonResult(true,200,null,null);
    }
    public static JsonResult successd(Object data){
        return new JsonResult(true,200,null,data);
    }

    public static JsonResult faild(String message){
        return new JsonResult(false,500,message,null);
    }

    public static JsonResult faild(Integer errorCode, String message) {
        return new JsonResult(false,errorCode,message,null);
    }

    public static JsonResult faild(Integer errorCode, String message, Object data) {
        return new JsonResult(false,errorCode,message,data);
    }

}
